<template>
    <view v-if="listData && listData.length">
        <view v-if="!isOldStyle" class="card-travel" :style="`${styles}`">
            <view class="card-travel-title">
                <text>残疾人出行 </text>
                <view @click="handleClickMore">更多 <img
                        src="https://zjcl-ywpt.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/zlb-zhzc/zhzc-arrow.png"
                        alt=""> </view>
            </view>

            <view class="card-travel-list" :style="{ 'background': listData[0].bgcolor }">
                <view class="card-travel-list-item" v-for="(item, index) in listData" :key="index"
                    @click="handleItemClick(item)"
                    :style="{ 'background-image': 'url(https://zjcl-ywpt.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/zlb-zhzc/zhzc-travel-bj-' + (index + 1) + '.png)' }">
                    <svg v-if="!item.icon.includes('http')" class="icon" aria-hidden="true">
                        <use :xlink:href="'#' + item.icon" />
                    </svg>
                    <img v-else :src="item.icon" alt="" class="icon">
                    <view class="card-travel-list-item-content">
                        <text>{{ item.alias ? item.alias : item.name }}</text>
                        <text>{{ item.notice }}</text>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
  
  
<script lang="ts" setup>
import { ref } from "vue";
const props = defineProps({
    styles: String,
    isOldStyle: Boolean,
    matterList: Array
})
let styles = ref('')
if (props.styles) {
    styles.value = props.styles?.replace(/"/g, '');
}

const listData = ref([])

listData.value = props.matterList.filter((val, index) => {
    if (val.type.includes('4')) {
        if (val.name == '注册登记') {
            val.notice = '残疾人机动轮椅车'
        } else if (val.name == '燃油补贴') {
            val.notice = '残疾人机动轮椅车'
        } else if (val.name == '无障碍出行') {
            val.notice = '残疾人无障碍地图'
        }
        return val.type.includes('4')
    }
})


const emit = defineEmits(['handleClick', 'handleClickMore'])
const handleItemClick = (item: any) => {
    emit('handleClick', {
        url: item.url,
        content: item.name
    })
}
const handleClickMore = () => {
    emit('handleClickMore', {
        type: 'travel'
    })
}
</script>
  
  
<style lang="scss" scoped>
.card-travel {
    width: 650upx;
    height: auto;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 1);
    color: rgba(16, 16, 16, 1);
    font-size: 14px;
    margin: 0 auto;
    margin-top: 24upx;
    position: relative;
    overflow: hidden;
    padding: 20upx;

    .card-travel-title {
        color: rgba(54, 58, 68, 1);
        font-size: 36upx;
        font-weight: bold;
        display: flex;
        justify-content: space-between;

        view {
            font-size: 24upx;
            height: 42upx;
            color: #686B73;
            font-weight: normal;
            display: flex;
            align-items: center;

            img {
                width: 24upx;
                height: 24upx;
                margin-left: 5upx;
            }
        }
    }

    .card-travel-list {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-top: 24upx;
        flex-wrap: wrap;

        .card-travel-list-item {
            width: 205upx;
            height: 215upx;
            display: flex;
            align-items: center;
            flex-direction: column;
            justify-content: space-between;
            background-size: 100% 100%;

            .icon {
                width: 80upx;
                height: 80upx;
                margin-top: 24upx;
            }

            .card-travel-list-item-content {
                width: 100%;
                text-align: center;
                display: flex;
                flex-direction: column;

                text:nth-child(1) {
                    color: #363A44;
                    font-size: 30upx;
                }

                text:nth-child(2) {
                    color: #686B73;
                    font-size: 24upx;
                    margin-bottom: 14upx;
                }
            }
        }

    }





}
</style>